$(document).ready(function() {
    var authenticity_token = $('#hidden_form input').val();
    var category_id = $('#cate_id').text();
    var update_url = "/products/update?authenticity_token=" + authenticity_token +"&category_id=" + category_id;

    $(".edit_name").editable(update_url,
    {
        name : 'product[name]',
        indicator : "提交中..",
        tooltip   : '点击编辑',
        onblur : 'submit',
        event  : 'dblclick'
    });

    $(".edit_purchase_price").editable(update_url,
    {
        name : 'product[purchase_price]',
        indicator : "提交中..",
        tooltip   : '点击编辑',
        onblur : 'submit',
        event  : 'dblclick'
    });

    $(".edit_cost_price").editable(update_url,
    {
        name : 'product[cost_price]',
        indicator : "提交中..",
        tooltip   : '点击编辑',
        onblur : 'submit',
        event  : 'dblclick'
    });

    $(".edit_retail_price").editable(update_url,
    {
        name : 'product[retail_price]',
        indicator : "提交中..",
        tooltip   : '点击编辑',
        onblur : 'submit',
        event  : 'dblclick'
    });
});